package com.xf.system.exception;
import java.util.regex.Pattern;

/**
 * @author xiefengf
 */
public final class BusinessUrns {
    private static final Pattern UUID = Pattern.compile("[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}");
    private static final Pattern NUMBER = Pattern.compile("[0-9]+");

    public BusinessUrns() {
    }

    public static boolean isUUID(String string) {
        return UUID.matcher(string).matches();
    }

    public static boolean isNumber(String string) {
        return NUMBER.matcher(string).matches();
    }

    public static boolean isUrn(String urn) {
        return !isNumber(urn) && !isUUID(urn);
    }
}
